package cn.ylz.ylmall.content.dao.persist.repository.impl;


import cn.ylz.ylmall.content.dao.persist.mapper.CollectMapper;
import cn.ylz.ylmall.content.dao.persist.repository.ICollectRepository;
import cn.ylz.ylmall.content.pojo.entity.Collect;
import cn.ylz.ylmall.content.pojo.vo.CollectStandardVO;
import cn.ylz.ylmall.content.pojo.vo.CountVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class CollectRepositoryImpl implements ICollectRepository {
    @Autowired
    private CollectMapper collectMapper;
    @Override
    public int insert(Collect collect) {
        return collectMapper.insert(collect);
    }

    @Override
    public CollectStandardVO selectIsCollect(Long userId, Long contentId) {
        System.out.println(collectMapper.selectIsCollect(userId,contentId));
        return collectMapper.selectIsCollect(userId,contentId);
    }

    @Override
    public int delete(Long userId, Long contentId) {

        return collectMapper.deleteCollect(userId,contentId);
    }

    @Override
    public CountVO count(Long contentId) {
        return collectMapper.countCollect(contentId);
    }
}
